package com.design.behaviorpattern;

/**
 * @author lizy4
 * @className ACourse
 * @date 2020/11/15 21:33
 * @description
 */
public abstract class ARefund {
    protected final void doRefund(){
        this.packageRefund();
        this.apply();
        if (needVerify()){
            this.verify();
        }
        this.refundMoney();
    }

    final void apply(){
        System.out.println("申请");
    }

    final void verify(){
        System.out.println("审核");
    }

    final void refundMoney(){
        System.out.println("退款");
    }

    // 钩子方法 - 是否需要审核
    protected boolean needVerify(){
        return false;
    }

    // 包装退款 - 延迟到子类实现
    abstract void packageRefund();

}
